<div class="surveysobject_new">
<% if params[:controller] == "candidates" %>
<% if @current_user.has_candidate_role(@group.id) %>
<%= link_to '[調査対象の新規作成]', new_group_candidate_path(@group) %>
<% end %>
<a href=<%="\"/external/register/" + @group.id.to_s + "\""%> >[新規一括取込]</a>
<% end %>
</div>
<table class="surveysobject">
  <tr class="surveysobject">
    <th class="surveysobject">調査対象コード</th>
    <th class="surveysobject">名称</th>
    <th class="surveysobject">TEL番号</th>
    <th class="surveysobject">FAX番号</th>
	<% if params[:controller] == "candidates" %>
    <th class="surveysobject">操作</th>
	<% end %>
  </tr>

  <% count = 0 %>
  <% @candidates.each do |candidate| %>
  <% count = (count + 1) & 1 %>
  <% if count == 0 %>
  <tr class="surveysobject">
  <% else %>
  <tr class="surveysobject_dark">
  <% end %>
   	<td class="surveysobject"><%=h candidate.candidate_code %></td>
   	<td class="surveysobject"><%= link_to candidate.candidate_name, group_candidate_path(@group, candidate) %></td>
   	<td class="surveysobject"><%=h candidate.tel_number %></td>
   	<td class="surveysobject"><%=h candidate.fax_number %></td>
	<% if params[:controller] == "candidates" %>
    <% if @current_user.has_candidate_role(@group.id) %>
    <td class="surveysobject_manage"><%= link_to '削除', group_candidate_path(@group, candidate), :confirm => '削除してもよろしいですか？', :method => :delete %></td>
    <% else %>
    <td class="surveysobject_manage">操作できません</td>
    <% end %>
    <% end %>
  </tr>
<% end %>
</table>
